<template>
  <el-scrollbar height="100%">
    <kdcrud :options="options" :model="model"></kdcrud>
  </el-scrollbar>
</template>

<script setup>
import { reactive,getCurrentInstance } from 'vue';
import options from './options'
import model from './model';
import {formatDateTimes } from '@/utils/index'
import {useStore} from "vuex";
const store = useStore();
const {proxy} = getCurrentInstance();
const state = reactive({
  start:0,
  end:0,
  messageType:0,
  facilities_id:0,
  pageIndex:1,
  pageSize:10,
});
//下拉列表
const getMessageType = async () => {
  const res = await proxy.$getMessageTypeList()
  options.config.formItemArr[2].options.optionArr = res.results.map((item,index)=>{
    return {
      label: item.name,
      value: index
    }
  })
  console.log("type",res)
5
}
getMessageType();

// 级联列表
(async ()=>{
  const res = await store.dispatch("getPark")
options.config.formItemArr[3].options.optionArr = res.map((item)=>{
  console.log(item);
    const children = item.children.map((child)=>{
     return {
      label:child.name,
      value:child.id,
     }
    })
    return{
      ...item,
      children,
}
  })
})()

</script>

<style lang="scss" scoped>
  :deep(.el-form){
    display: flex;
 }
 :deep(.el-form-item__content){
  margin-left: 10px !important;
 }
</style>
